convert part 4

float32_to_atom

include convert.e 
namespace convert 
public function float32_to_atom(sequence_4 ieee32) 

converts a sequence of 4 bytes in IEEE 32-bit format to an atom.

Parameters:
  1. ieee32 : the sequence to convert.
Returns:

An atom, the same value as the FPU would see by peeking ieee64 from RAM.

Comments:

Any 32-bit IEEE floating-point number can be converted to an atom.

Example 1:
f = repeat(0, 4) 
fn = open("numbers.dat", "rb") -- read binary 
f[1] = getc(fn) 
f[2] = getc(fn) 
f[3] = getc(fn) 
f[4] = getc(fn) 
a = float32_to_atom(f) 
See Also:

float64_to_atom, bytes_to_int, atom_to_float32

hex_text

include convert.e 
namespace convert 
public function hex_text(sequence text) 

converts a text representation of a hexadecimal number to an atom.

Parameters:
  1. text : the text to convert.
Returns:

An atom, the numeric equivalent to text

Comments:
  • The text can optionally begin with '#' which is ignored.
  • The text can have any number of underscores, all of which are ignored.
  • The text can have one leading '-', indicating a negative number.
  • The text can have any number of underscores, all of which are ignored.
  • Any other characters in the text stops the parsing and returns the value thus far.
Example 1:
 atom h = hex_text("-#3_4FA.00E_1BD") 
 -- h is now -13562.003444492816925 
 atom h = hex_text("DEADBEEF") 
 -- h is now 3735928559 
See Also:

value

set_decimal_mark

include convert.e 
namespace convert 
public function set_decimal_mark(integer new_mark) 

gets, and possibly sets, the decimal mark that to_number uses.

Parameters:
  1. new_mark : An integer: Either a comma (,), a period (.) or any other integer.
Returns:

An integer, The current value, before new_mark changes it.

Comments:
  • When new_mark is a period it will cause to_number to interpret a dot (.) as the decimal point symbol. The pre-changed value is returned.
  • When new_mark is a comma it will cause to_number to interpret a comma (,) as the decimal point symbol. The pre-changed value is returned.
  • Any other value does not change the current setting. Instead it just returns the current value.
  • The initial value of the decimal marker is a period.
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu